diff options
| author | Adam Soltys <[email protected]> | 2022-09-13 23:18:40 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-13 23:18:40 -0700 |
| commit | dfe32780e0862515eb4b2ddebae9fcfb2198704a (patch) | |
| tree | f8b463ccc51291393c71cc3c95ca3725c74d341b /src/routes/[username]/dashboard | |
| parent | cfdc6ed4a98e1eb60aba653d4403138a8fcaa4c2 (diff) | |
| download | coinos-ui-dfe32780e0862515eb4b2ddebae9fcfb2198704a.tar.gz coinos-ui-dfe32780e0862515eb4b2ddebae9fcfb2198704a.zip | |
currency formatting helpers
Diffstat (limited to 'src/routes/[username]/dashboard')
| -rw-r--r-- | src/routes/[username]/dashboard/+page.svelte | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/routes/[username]/dashboard/+page.svelte b/src/routes/[username]/dashboard/+page.svelte index e61360c9..eee13576 100644 --- a/src/routes/[username]/dashboard/+page.svelte +++ b/src/routes/[username]/dashboard/+page.svelte @@ -1,5 +1,5 @@ <script> - import { post, failure } from '$lib/utils'; + import { f, s, post, failure } from '$lib/utils'; import { tick } from 'svelte'; import { AppHeader, Icon } from '$comp'; import { selectedRate } from '$lib/store'; @@ -27,21 +27,13 @@ } }; - $: btcPrice = new Intl.NumberFormat('en-US', { - style: 'currency', - currency: user.currency - }).format($selectedRate); + $: btcPrice = f($selectedRate, user.currency); - $: accountBalanceFiat = new Intl.NumberFormat('en-US', { - style: 'currency', - currency: user.currency - }).format(user.account.balance * ($selectedRate / 100000000)); + $: accountBalanceFiat = f(user.account.balance * ($selectedRate / 100000000), user.currency); $: accountBalanceBtc = user.account.balance / 100000000; - $: accountBalanceSats = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format( - user.account.balance - ); + $: accountBalanceSats = s(user.account.balance); </script> <AppHeader avatarPosition="left-[calc(50vw-48px)] lg:left-[calc(15vw-48px)]" /> |
